<template>
    <div class="">
        <h1>微信h5支付</h1>
        <button @click="goPay">支付0.01元</button>
    </div>
</template>

<script>
import axios from 'axios';
const serveHost = 'http://www.bufantec.com';
export default {
    components: {

    },
    data() {
        return {

        };
    },
    computed: {

    },
    created() {

    },
    mounted() {

    },
    methods: {
        goPay(){
            // 1. 请求下单
            // h5支付api  /wx/pay/wap2
            var url = `${serveHost}/wx/pay/wap2` 
            axios.get(url)
                .then(res=>{
                    var url = res.data.url;
                    // https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx10105118201200b973747345516f0f0000&package=1906571794&redirect_url=http://bufantec.natapp1.cc/wx/pay_succ
                    window.location.href = url;
                    // console.log(res);
                })

        }
    },
};
</script>

<style scoped lang="scss">

</style>

